﻿using B.S.Filtration.Write.Api.Application.Command.FiltrateCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using B.S.Filtration.ErrorCode;

namespace B.S.Filtration.Write.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class FiltrateController : ControllerBase
    {
        private readonly IMediator mediator;

        public FiltrateController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 添加发酵液信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> CreateFiltrate(CreateFiltrateCommand request)
        {
            return await  mediator.Send(request);
        }

        /// <summary>
        /// 删除发酵液信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> DelFiltrate(DelFiltrateCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 修改发酵液信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdFiltrate(UpdFiltrateCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
